package com.sso.config;

import com.sso.filter.MyTokenFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.web.authentication.www.BasicAuthenticationFilter;
import org.springframework.security.web.header.writers.frameoptions.WhiteListedAllowFromStrategy;
import org.springframework.security.web.header.writers.frameoptions.XFrameOptionsHeaderWriter;

import java.util.Arrays;

@Configuration
@EnableWebSecurity
public class WebSecurityConfig1 extends WebSecurityConfigurerAdapter {

    public MyTokenFilter myTokenFilter(){
        return new MyTokenFilter();
    }
    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.addFilterBefore(myTokenFilter(), BasicAuthenticationFilter.class);
    }
}
